<%@page import="com.chinacreator.galaxylive.utils.IPUtil"%>
<%@page import="dm.jdbc.util.IPAddressUtil"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String liveId = request.getParameter("liveId");
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+path+"/";
	String ip = IPUtil.getIpAddress(request);
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" name="viewport"/> 
	<meta content="yes" name="apple-mobile-web-app-capable"/>
	<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
	<meta content="telephone=no" name="format-detection"/>
    <title>直播</title>
	<link rel="stylesheet" href="css/base.css">
	<link rel="stylesheet" href="css/page.css?2">
	<script type="text/javascript" src="js/bdplayer/cyberplayer.js"></script>
</head>

<body>
	<article class="video_box">
			<section class="video">
				<!-- 回看层 -->
				<div id="videoBack"></div>
				
				<!-- 直播层 -->
				<video id="videoLive"  controls="controls" x5-playsinline="" playsinline="" webkit-playsinline="" poster=""
				preload="auto" style="display:none;">				
				</video>
				
				<!-- 播放背景 -->
				<div id="video" onclick="playLive()" style="display:none;height: 100%;">
					<span id="liveBtn" style="display:none"><img src="images/video.png"></span>
					<p style="display:none;"><input id="payBtn" type="button" value="免费报名"></p>
					<p id="videoBtn" style="display:none;"><input type="button" value="-" style="background:#444444"></p>
				</div>				
			</section>
	</article>	
	
    <!-- script -->
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="js/jweixin-1.0.0.js"></script>	
    <script type="text/javascript">	  	  
		var shareTitle ="银河直播";
		var shareContent ="点击链接有机会免费观看名师课程，名额有限，先到先得！";
		var shareImg = "<%=basePath%>/lives/images/logo.png";
		var shareUrl = window.location.href;
		var currentUrl = window.location.href;

		var MQTTHttps;
		var MQTTUrl;
		var MQTTPort;

		var userId;
        var userName;
        var userImg;
        var liveId = '<%=liveId%>';
        var userIp = '<%=ip%>';
		var jsapiSignature;
		var appId;
		var connectFlag = false; //是否连接
        var isOpen = true;
		var hasPwd = false;
        var player = null;
		var anchorId = null;
		var orgType = null;
		
	    
		$(document).ready(function(){
            var video = $(".video");
            var videoWidth = video.width();
            var videoHeight = parseInt(videoWidth * 2 / 3);
            //var videoHeight = parseInt(videoWidth*9/16);
            $(".video").css("height",+videoHeight+"px");
            $("#video").css("height",+videoHeight+"px");
            $("#videoLive").css("height",+videoHeight+"px");
            $("#videoBack").css("height",+videoHeight+"px");
            $(".talk").css("top",+videoHeight+86+"px");
            $(".introduce").css("top",+videoHeight+86+"px");
            
			$.ajax({
				url:"../page/detail",
				type:'get',
				dataType:'json',
                data:{"url":currentUrl},
				async: false,
				success : function(data) {
					userId = data.userId;
					jsapiSignature = data.jsapiSignature;
					appId =  data.appId;
                    userName = data.userName;
                    userImg = data.userImg;
			});
		}
			

		//通过config接口注入权限验证配置		
		function shareConfig(){
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: appId,
				timestamp: jsapiSignature.timestamp,
				nonceStr: jsapiSignature.nonceStr,
				signature: jsapiSignature.signature,
				jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage','chooseWXPay'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});

			wx.ready(function () {
				wx.onMenuShareAppMessage({
					title: shareTitle,
					desc: shareContent,
					link: shareUrl + "&shareUser="+userId ,
					imgUrl: shareImg
				});

				wx.onMenuShareTimeline({
					title: shareTitle,
					desc: shareContent,
					link: shareUrl + "&shareUser="+userId,
					imgUrl: shareImg
				});

			});
		}
                
    </script>
    <script type="text/javascript" src="js/busi/rewardpay.js"></script>     
    <script type="text/javascript" src="js/number.js"></script> 
</body>
</html>
